#ifndef _DOFABSTRACT_
#define _DOFABSTRACT_

#include "vl/VLd.h"
#include <vector>
#include <cassert>

using namespace std;

class DofAbstract{
	protected:
		int mNumPts;	// mCtrlPts.size
		int mStartIndex;	// index in the state vector

	public:
		DofAbstract(){}

		virtual double getValue(double nFrame)=0;
		virtual double getSlope(double _frame)=0;
		virtual double getSecondSlope(double _frame)=0;


		virtual double getCtrlPtCoord(int _numC)=0;
		virtual double getCtrlPtValue(int _numC)=0;
		virtual void setCtrlPtValue(int _numC, double _v)=0;

		virtual void getCtrlPts(double *state)=0;
		virtual void getCtrlPts(double *state, int _start, int _end)=0;
		virtual void setCtrlPts(double *state)=0;
		virtual void setCtrlPts(double *state, int _start, int _end)=0;
		virtual void addCtrlPtsDiff(double *state, int _start, int _end)=0;

		virtual void setValue(double nFrame, double val)=0;	// sets the value of ctrlpts such that the value at this frame is val
		virtual void initValues(vector<double> q)=0;	//	inits the values from all samples as close as possible

		virtual double getDerivative(double nFrame, int npt)=0;	// derivative wrt to ith ctrlpt
		virtual double getSlopeDerivative(double nFrame, int npt)=0;	// derivative of velocity wrt to ith ctrlpt
		virtual double getSecondDerivative(double nFrame, int npt)=0;

		// get ctrl pt indices for value and velocity
		virtual void getCtrlPtIndices(double nFrame, int *npts, vector<int> *indices)=0;
		virtual void getVelCtrlPtIndices(double nFrame, int *npts, vector<int> *indices)=0;
		
		inline int getNumCtrlPts(){return mNumPts;}
		inline int getStartIndex(){return mStartIndex;}
		inline void setStartIndex(int _index){mStartIndex=_index;}	// able to adjust the index from outside
};

#endif
